import openpyxl
import json

wb = openpyxl.load_workbook('精准编译.xlsx')
sheet = wb.worksheets[1]

data = []
headers = [cell.value for cell in sheet[1]]

for row in sheet.iter_rows(min_row=2, values_only=True):
    item = {}
    for header, value in zip(headers, row):
        if header == '蓝区仓名':
            item['name'] = value
        if header == '编译命令':
            target = value.replace('./build_system.sh --abi-type generic_generic_arm_64only --device-type hisi_higeneric_newphone_standard --ccache --build-variant root --build-target ','')
            target = target.replace(' --gn-args build_xts=true --export-para xts_suitename:acts','')
            item['buildTarget'] = target
    data.append(item)

with open('output.json', 'w') as json_file:
    json.dump(data, json_file, indent=4)
